package com.admin.base;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.admin.system.entity.SystemUser;

/**
 * @author : alex
 * @date : 2020/2/10
 */
public class BaseController {
	protected Logger logger = LoggerFactory.getLogger(this.getClass());

	/**
	 * 获取登录用户
	 * 
	 * @return
	 */
	protected SystemUser getLoginUser() {
		Subject subject = SecurityUtils.getSubject();
		if (subject == null) {
			throw new RuntimeException("获取用户登录用户信息异常");
		}

		SystemUser loginUser = (SystemUser) subject.getPrincipal();

		return loginUser;
	};
}
